import axios from "axios";
axios.defaults.baseURL = process.env.VUE_APP_API_BASE_URL;
export const request = async (options = { method: 'GET' }) => {
  let is_body = false;
  if(options.method == "POST") {
    is_body = true;
  }
  const res = await axios({
    url: options.url,
    method: options.method,
    data: is_body ? options.data : null,
    params: !is_body ? options.params : null
  });
  if (res.status == 200) {
    return res.data;
  }else{
    return {code: 1}
  }
} 